<template>
  <div class="home-con">
    <div class="header-top">
      <div class="logo">
        <img src="imgs/logo.png" alt="">
      </div>
      <div class="search" @click="goSearch">
        <div class="search-box">
          <div class="icon-search">
            <img src="imgs/icon-search.png" alt="">
          </div>
          请输入要搜索的商品
        </div>
      </div>
      <div class="user">
        <router-link to="/user">
          <img src="imgs/user.png" alt="">
        </router-link>
      </div>
    </div>
    <div class="haeder-bottom">
      <van-tabs v-model="active" animated>
        <van-tab title="推荐">
          <Hot></Hot>
        </van-tab>
        <van-tab title="智能">
          <Smart />
        </van-tab>
        <!-- <van-tab title="电视">内容 3</van-tab> -->
        <van-tab title="笔记本">
          <NoteBook></NoteBook>
        </van-tab>
      </van-tabs>
    </div>
  </div>
</template>

<script>
import Hot from '@/views/home/hot.vue'
import Smart from '@/views/home/smart.vue'
import NoteBook from './book.vue'
export default {
  name: 'HomeCon',
  data() {
    return {
      active: 0
    }
  },
  components: {
    Hot,
    Smart,
    NoteBook
  },
  methods: {
    goSearch() {
      this.$router.push('/search')
    }
  }
}
</script>

<style lang='less' >
.home-con {
  width: 100%;
  .header-top {
    position: fixed;
    width: 100%;
    top: 0;
    display: flex;
    height: 84px;
    align-items: center;
    justify-content: space-between;
    background: #f2f2f2;
    z-index: 999;

    .logo {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100px;
      img {
        width: 51px;
        height: 51px;
      }
    }
    .search {
      flex: 1;
      height: 61.6px;
      border: 1px solid #e5e5e5;
      background-color: #fff;
      font-size: 30px;
      color: rgba(0, 0, 0, 0.3);
      .search-box {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        .icon-search {
          width: 60px;
          height: 60px;
          padding: 10px;
          img {
            display: inline-block;
            width: 40px;
            height: 40px;
          }
        }
      }
    }
    .user {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100px;
      img {
        width: 51px;
        height: 51px;
      }
    }
  }
  .haeder-bottom {
    height: 56.6px;
  }
}
</style>
<style scoped>
/deep/ .van-tabs__wrap {
  position: sticky;
  top: 84px;
  z-index: 999;
  height: 56.6px;
}
/deep/ .van-tabs__nav {
  background-color: #f2f2f2;
}
/deep/ .van-tabs__line {
  background-color: #f28533;
}
/deep/ .van-tab {
  font-size: 26px;
  font-weight: 500;
  color: #636161;
}
/deep/ .van-tab__text--ellipsis {
  overflow: unset;
}
/deep/ .van-tab--active {
  color: #f28533;
}
</style>
